#pragma once
#include <iostream>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <string>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>


#define NUM 10 // 进程池里进程的个数

using namespace std;

typedef void(*task_t)();// 函数指针

vector<task_t> tasks;

class channel
{
public:
    channel(int cmdfd,string processname,pid_t processid)
        :_cmdfd(cmdfd)
        ,_processname(processname)
        ,_processid(processid)
    {}
public:
    int _cmdfd;// 父进程发送任务的文件描述符
    string _processname;// 进程名
    pid_t _processid;// 子进程的PID
};

void task1()
{
    cout<<"球队：利物浦"<<endl;
    cout<<"排名：第01名"<<endl;
    cout<<"积分：84"<<endl;
    cout<<endl;
}

void task2()
{
    cout<<"球队：阿森纳"<<endl;
    cout<<"排名：第02名"<<endl;
    cout<<"积分：74"<<endl;
    cout<<endl;
}

void task3()
{
    cout<<"球队：切尔西"<<endl;
    cout<<"排名：第04名"<<endl;
    cout<<"积分：69"<<endl;
    cout<<endl;
}

void task4()
{
    cout<<"球队：布莱顿"<<endl;
    cout<<"排名：第08名"<<endl;
    cout<<"积分：61"<<endl;
    cout<<endl;
}

void task5()
{
    cout<<"球队：水晶宫"<<endl;
    cout<<"排名：第12名"<<endl;
    cout<<"积分：53"<<endl;
    cout<<endl;
}

void task6()
{
    cout<<"球队：曼城队"<<endl;
    cout<<"排名：第03名"<<endl;
    cout<<"积分：71"<<endl;
    cout<<endl;
}

void task7()
{
    cout<<"球队：曼联队"<<endl;
    cout<<"排名：第15名"<<endl;
    cout<<"积分：42"<<endl;
    cout<<endl;
}

void LoadTask()
{
    tasks.push_back(task1);
    tasks.push_back(task2);
    tasks.push_back(task3);
    tasks.push_back(task4);
    tasks.push_back(task5);
    tasks.push_back(task6);
    tasks.push_back(task7);
}


